home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / Information / CSMP Digest / volume 1 / csmp-v1-131.txt < prev    next >
Encoding:
Text File  |  1994-12-08  |  40.2 KB  |  1,154 lines  |  [TEXT/R*ch]

  1. C.S.M.P. Digest             Fri, 03 Jul 92       Volume 1 : Issue 131
  2.  
  3. Today's Topics:
  4.  
  5.     SCSI Device Type Codes?
  6.     Comparing blocks of memory in Think Pascal 4? How?
  7.     Not So Amusing MPW C v3.2 Error Messages
  8.     Ridiculous MemoryMgr Problem
  9.     Globals, A5, and all that stuff...
  10.     Dumb THINK C Projects!
  11.     Apple Modem Tool 1.1 Bugs?
  12.     Moving windowws
  13.     Unet.Mac.Pgm.Guide in PostScript available for FTP
  14.     Launching from a code resource, revisited...
  15.     _Datainit() : what does it do & where does it do it?
  16.  
  17.  
  18.  
  19. -------------------------------------------------------
  20.  
  21. From: topix@gpu.utcs.utoronto.ca (R. Munroe)
  22. Subject: SCSI Device Type Codes?
  23. Organization: UTCS Public Access
  24. Date: Sun, 31 May 1992 07:36:55 GMT
  25.  
  26.  
  27. Does anyone have a complete list of SCSI type codes (as returned by
  28. a standard SCSI inquiry command)?  I think that hard disks are 0, tape
  29. drives are 1, and CD-ROMS are 5, but beyond that I'm clueless.
  30.  
  31. Thanks.
  32.  
  33. Bob
  34.  
  35. - -- 
  36. John Mariella                             :Internet:   topix@utcs.utoronto.ca
  37. Animation Director                         
  38. TOPIX Computer Graphics + Animation, Inc.  
  39.  
  40. +++++++++++++++++++++++++++
  41.  
  42. From: maarten@fwi.uva.nl (Maarten Carels)
  43. Date: 1 Jun 92 08:20:42 GMT
  44. Organization: FWI, University of Amsterdam
  45.  
  46. topix@gpu.utcs.utoronto.ca (R. Munroe) writes:
  47.  
  48.  
  49. >Does anyone have a complete list of SCSI type codes (as returned by
  50. >a standard SCSI inquiry command)?  I think that hard disks are 0, tape
  51. >drives are 1, and CD-ROMS are 5, but beyond that I'm clueless.
  52.  
  53. An almost complete list:
  54.      0    Disk
  55.      1    Tape
  56.      2    Printer
  57.      3    Processor
  58.      4    WORM Device
  59.      5    CD-ROM Device
  60.      6    Scanner
  61.      7    Optical Memory
  62.      8    Medium Changer
  63.      9    Communication Device
  64.     10    ASC IT8 (Whatever that may be)
  65.     11    ASC IT8 (Whatever that may be)
  66.         Other values reserved.
  67.  
  68.  
  69. - --maarten
  70. - -- 
  71. In real life:    Maarten Carels
  72.         Computer Science Department
  73.         University of Amsterdam
  74. email:        maarten@fwi.uva.nl
  75.  
  76. +++++++++++++++++++++++++++
  77.  
  78. From: ephraim@think.com (Ephraim Vishniac)
  79. Date: 1 Jun 1992 14:04:10 GMT
  80. Organization: Thinking Machines Corporation, Cambridge MA, USA
  81.  
  82. In article <1992Jun1.082042.8931@fwi.uva.nl> maarten@fwi.uva.nl (Maarten Carels) writes:
  83. >topix@gpu.utcs.utoronto.ca (R. Munroe) writes:
  84. >>Does anyone have a complete list of SCSI type codes (as returned by
  85. >>a standard SCSI inquiry command)?  I think that hard disks are 0, tape
  86. >>drives are 1, and CD-ROMS are 5, but beyond that I'm clueless.
  87.  
  88. >An almost complete list:
  89. >     0    Disk
  90. >     1    Tape
  91. >     2    Printer
  92. >     3    Processor
  93. >     4    WORM Device
  94. >     5    CD-ROM Device
  95. >     6    Scanner
  96. >     7    Optical Memory
  97. >     8    Medium Changer
  98. >     9    Communication Device
  99. >    10    ASC IT8 (Whatever that may be)
  100. >    11    ASC IT8 (Whatever that may be)
  101. >        Other values reserved.
  102.  
  103. The SCSI-2 spec says:
  104.  
  105. 00h    Direct-access device (e.g., magnetic disk)
  106. 01h    Sequential-access device (e.g., magnetic tape)
  107. 02h    Printer device
  108. 03h    Processor device
  109. 04h    Write-once device (e.g., some optical disks)
  110. 05h    CD-ROM device
  111. 06h    Scanner device
  112. 07h    Optical memory device (e.g., some optical disks)
  113. 08h    Medium changer device (e.g., jukeboxes)
  114. 09h    Communications device
  115. 0Ah - 0Bh    Defined by ASC IT8 (Graphics Arts Pre-Press Devices)
  116. 0Ch - 1Eh    Reserved
  117. 1Fh    Unknown or no device type
  118.  
  119. These official descriptions are slightly more inclusive than the ones
  120. that Maarten gave. For example, a box full of solid-state memory isn't
  121. a disk, but it could easily be a direct-access device. 
  122.  
  123. - -- 
  124. Ephraim Vishniac    ephraim@think.com   ThinkingCorp@applelink.apple.com
  125.  Thinking Machines Corporation / 245 First Street / Cambridge, MA 02142
  126.         One of the flaws in the anarchic bopper society was
  127.         the ease with which such crazed rumors could spread.
  128.  
  129. ---------------------------
  130.  
  131. Subject: Comparing blocks of memory in Think Pascal 4? How?
  132. From: stanger@otago.ac.nz (Nigel Stanger)
  133. Date: 1 Jun 92 16:58:45 +1300
  134. Organization: University of Otago, Dunedin, New Zealand
  135.  
  136. Is there any way of comparing two arbitrarily (but equal) sized
  137. blocks of memory in Think Pascal? What I have is a RECORD
  138. (PrefsType) that I store my apps preferences in -- it's currently
  139. 26 bytes long, but may get bigger later on. Now since you can't
  140. just say: IF (prefs1 = prefs2) THEN..., I had to write a routine
  141. to check whether two PrefsType records are identical. ('=' in TP
  142. only lets you compare simple types, not structures.)
  143.  
  144. Now, given that I have to individually compare about 13 different
  145. fields in the record, I thought it would be nice to just directly
  146. compare the two records as blocks of memory (or something like
  147. that). I played around with type-casting, but nothing worked
  148. there (because the only way I could get something with a size of
  149. 26 bytes was to make it a structured type, and I was back where I
  150. started). Then I tried this:
  151.  
  152. FUNCTION Identical (item1, item2 : UNIV Ptr) : Boolean;
  153. BEGIN
  154.   IF (item1^ = item2^) THEN
  155.     Identical := TRUE
  156.   ELSE
  157.     Identical := FALSE;
  158. END;
  159.  
  160.   IF Identical(@prefs1, @prefs2) THEN ...
  161.  
  162. Of course, this didn't work because a Ptr is a pointer to a
  163. SignedByte, so only the first byte of the record was getting
  164. compared -- it just so happens that the first byte is the version
  165. number of the preferences structure and is always identical in
  166. both of them no matter what. I tried mucking around with
  167. SetPtrSize, but that didn't work either.
  168.  
  169. I think this would be fairly trivial in C, but I don't have C yet
  170. :( Any suggestions on what I could try next? I've run out of
  171. ideas. Inline assembler perhaps? Or something simpler that I'm
  172. missing? Thanks!
  173.  
  174. - -- 
  175. See ya
  176.                                 Nigel.
  177. - ----------------------------------------------------------------------
  178. Nigel Stanger,                  Internet: stanger@otago.ac.nz
  179. University of Otago,            Phone: +64 3 479-8179
  180. Dunedin, NEW ZEALAND.           Fax:   +64 3 479-8311
  181. "And whatever you do, don't mention the War." -- Basil Fawlty, "Fawlty Towers"
  182.  
  183. +++++++++++++++++++++++++++
  184.  
  185. From: mxmora@unix.SRI.COM (Matt Mora)
  186. Date: 1 Jun 92 15:52:58 GMT
  187. Organization: SRI International, Menlo Park, California
  188.  
  189. In article <1992Jun1.165845.2863@otago.ac.nz> stanger@otago.ac.nz (Nigel Stanger) writes:
  190. >Is there any way of comparing two arbitrarily (but equal) sized
  191. >blocks of memory in Think Pascal? What I have is a RECORD
  192. >(PrefsType) that I store my apps preferences in -- it's currently
  193. >26 bytes long, but may get bigger later on. Now since you can't
  194. >just say: IF (prefs1 = prefs2) THEN..., I had to write a routine
  195. >to check whether two PrefsType records are identical. ('=' in TP
  196. >only lets you compare simple types, not structures.)
  197.  
  198. Try:
  199.  
  200. IUMagIDString(aPtr,bPtr:Ptr;aLen,bLen:INTEGER):INTEGER;
  201.  
  202. It will compare blocks of memory and return a 0 if they are equal else
  203. it return a 1.
  204.  
  205. Look at IM vol 1 507;
  206.  
  207.  
  208. There are some other routines that do something similar.
  209.  
  210.  
  211.  
  212.  
  213. Matt
  214.  
  215.  
  216.  
  217.  
  218. - -- 
  219. ___________________________________________________________
  220. Matthew Mora                |   my Mac  Matt_Mora@sri.com
  221. SRI International           |  my unix  mxmora@unix.sri.com
  222. ___________________________________________________________
  223.  
  224. +++++++++++++++++++++++++++
  225.  
  226. From: quinn@cs.uwa.edu.au (Quinn "The Eskimo!")
  227. Organization: The University of Western Australia
  228. Date: Tue, 2 Jun 1992 01:37:35 GMT
  229.  
  230. In article <1992Jun1.165845.2863@otago.ac.nz>, stanger@otago.ac.nz (Nigel Stanger) writes:
  231. > Is there any way of comparing two arbitrarily (but equal) sized
  232. > blocks of memory in Think Pascal? What I have is a RECORD
  233. > (PrefsType) that I store my apps preferences in -- it's currently
  234. > 26 bytes long, but may get bigger later on. Now since you can't
  235. > just say: IF (prefs1 = prefs2) THEN..., I had to write a routine
  236. > to check whether two PrefsType records are identical. ('=' in TP
  237. > only lets you compare simple types, not structures.)
  238. > Now, given that I have to individually compare about 13 different
  239. > fields in the record, I thought it would be nice to just directly
  240. > compare the two records as blocks of memory (or something like
  241. > that).
  242.  
  243. A word of caution for the uninitiated.  If you're already familiar
  244. with record packing then please feel free to ignore my ravings.
  245.  
  246. The reason Pascal doesn't support comparing structured types is that
  247. not all the bits in a record or array are necessarily significant.
  248. For example:
  249.  
  250. type
  251.   a =
  252.     record
  253.       b : boolean;
  254.       c : char;
  255.       d : boolean;
  256.     end;
  257.  
  258. Acording to Think Pascal this has a size of 6.  Now there are only
  259. 3 bytes of real data in there so you're left with 3 bytes of rubbish.
  260. If you do a memory image compare you're going to be mislead, if
  261. not now then some time soon.
  262.  
  263. Of course if you stick to nice types like integer, longint, OSType,
  264. etc (things that are word sized or even multiples thereof) you'll
  265. be OK.  Things to be careful of are char, byte, signedByte, boolean,
  266. subranges, and arrays.  Also remember that if you make your records
  267. packed then all these rules change!
  268.  
  269. Quinn "The Eskimo!"   <quinn@cs.uwa.edu.au>  "Real Coke, Diet .sig"
  270. Department of Computer Science, The University of Western Australia
  271.   -- Careful With That Axe, Eugene!
  272.  
  273.  
  274. +++++++++++++++++++++++++++
  275.  
  276. From: d88-jwa@dront.nada.kth.se (Jon W{tte)
  277. Date: 2 Jun 92 18:57:15 GMT
  278. Organization: Royal Institute of Technology, Stockholm, Sweden
  279.  
  280. > mxmora@unix.SRI.COM (Matt Mora) writes:
  281.  
  282.    Try:
  283.  
  284.    IUMagIDString(aPtr,bPtr:Ptr;aLen,bLen:INTEGER):INTEGER;
  285.  
  286.    It will compare blocks of memory and return a 0 if they are equal else
  287.    it return a 1.
  288.  
  289. Ahem. That "IU" means that it will do some strange stuff with
  290. international characters...
  291.  
  292. - -- 
  293. h++ - new and improved ! And now on VACCATION !!!
  294. (My first for, oh, three years !)
  295.  
  296. ---------------------------
  297.  
  298. From: neeri@iis.ethz.ch (Matthias Neeracher)
  299. Subject: Not So Amusing MPW C v3.2 Error Messages
  300. Organization: Integrated Systems Laboratory, ETH, Zurich
  301. Date: Mon, 1 Jun 1992 09:58:24 GMT
  302.  
  303. In article <92May30.145216edt.144029@explorer.dgp.toronto.edu> flaps@dgp.toronto.edu (Alan J Rosenthal) writes:
  304.  
  305. >Can't cast a void type to type void (because the ANSI spec. says so, that's why)
  306.  
  307. The not so amusing aspect of this error message is that it is PLAIN WRONG.
  308. An authoritative source on comp.std.c quoted the ANSI standard as follows:
  309.  
  310. ANSI 3.2.2.2, first sentence:
  311. # "The (nonexistent) value of a void expression (an expression
  312. # that has type void) shall not be used in any way, and implicit or explicit
  313. # conversions (except to void) shall not be applied to such an expression."
  314.  
  315. So, while this error message is cute, it is *wrong*, and there is no reason for
  316. the compiler to give it, and it OUGHT TO BE REMOVED.
  317.  
  318. Matthias
  319.  
  320. - -----
  321. Matthias Neeracher                                   neeri@iis.ethz.ch
  322.  "You must have picked up that copy of Scarlett instead of Inside Mac
  323.   when you tried to find the right call..." -- Keith Rollin
  324.  
  325. +++++++++++++++++++++++++++
  326.  
  327. From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
  328. Organization: Kalamazoo College
  329. Date: Mon, 1 Jun 1992 20:24:27 GMT
  330.  
  331. neeri@iis.ethz.ch (Matthias Neeracher) writes:
  332. >flaps@dgp.toronto.edu (Alan J Rosenthal) writes:
  333. >
  334. >>Can't cast a void type to type void (because the ANSI spec.
  335. >>says so, that's why)
  336. >
  337. >The not so amusing aspect of this error message is that it is PLAIN WRONG.
  338. >ANSI 3.2.2.2, first sentence:
  339. > "The (nonexistent) value of a void expression (an expression
  340. > that has type void) shall not be used in any way, and implicit or explicit
  341. > conversions (except to void) shall not be applied to such an expression."
  342.  
  343. K&R, 2nd ed., agrees:  "The (nonexistent) value of a void object may not
  344. be used in any way, and neither explicit nor implicit conversion to any
  345. NON-VOID type may be applied." (my emphasis)
  346.  
  347. So what's up, O MPW C Compiler Writer?  Not that this is at all important.
  348. - -- 
  349.  Jamie McCarthy     Internet: k044477@kzoo.edu     AppleLink: j.mccarthy
  350.  Always set the version number that appears in some file manager calls to 0.
  351.  
  352. ---------------------------
  353.  
  354. From: gillies@m.cs.uiuc.edu (Don Gillies)
  355. Subject: Ridiculous MemoryMgr Problem
  356. Organization: University of Illinois, Dept. of Comp. Sci., Urbana, IL
  357. Date: Mon, 1 Jun 1992 09:58:59 GMT
  358.  
  359. I am having a ridiculous problem with the memory manager.  I am using
  360. THINK C 4.02, on a 5 Meg macintosh II with system 7.0.  My application
  361. needs about 600K of the heap, and ~ 40K of stack.  I made the
  362. partition 1150K and tried the following:
  363.  
  364.     SetZone(ApplicZone());
  365.     printf("limit is %ld\n", GetApplLimit());    /* prints 2929K */
  366.     printf("free is %ld\n", FreeMem());        /* prints 909K */
  367.     newlimit = GetApplLimit() - 40000L;        /* is 2889K */
  368.     SetApplLimit(newlimit);                /* crash here */
  369.     printf("free is %ld\n", FreeMem());
  370.     MaxApplZone();
  371.  
  372. The above code crashes in the "SetApplLimit" call.  The symptom of the
  373. crash is that the screen erases and all the windows lose their
  374. borders, and only the top-level window will appear on the screen
  375. (without border).  All the other windows look like ghostly shadows,
  376. and the finder seems to still be operating o.k., but because of the
  377. ghostly windows, it is impossible to do useful work.
  378.  
  379. The code used to work if the newlimit was 10000L less than
  380. GetApplLimit, but otherwise, it would not work.  Now I am using the
  381. following code:
  382.  
  383.     SetZone(ApplicZone());
  384.     printf("limit is %ld\n", GetApplLimit());
  385.     printf("free is %ld\n", FreeMem());        /* 909K */
  386.     newlimit = GetApplLimit() - 40000L;
  387. /*    SetApplLimit(newlimit); */
  388.     ApplLimit = newlimit;
  389.     printf("free is %ld\n", FreeMem());        /* 909K - 10 */
  390.     MaxApplZone();
  391.  
  392. This seems to work, but the amount of "FreeMem()" does not decrease
  393. after I decrement the global variable "ApplLimit".  (it decreases by a
  394. very small amount, presumably because of the "printf" command).  This
  395. worries me.  Does anyone know what is the problem?  It seems like
  396. "SetApplLimit" is flakey in this version of THINK C.  It seems like
  397. assigning to the "ApplLimit" global variable does not adequately
  398. inform the memory manager of the change in the application heap size.
  399.  
  400. Don Gillies - gillies@cs.uiuc.edu - University of Illinois at Urbana-Champaign
  401.  
  402.  
  403. - -- 
  404.  
  405.  
  406.  
  407.  
  408. +++++++++++++++++++++++++++
  409.  
  410. From: gillies@m.cs.uiuc.edu (Don Gillies)
  411. Organization: University of Illinois, Dept. of Comp. Sci., Urbana, IL
  412. Date: Mon, 1 Jun 1992 19:39:35 GMT
  413.  
  414. Oops, I made a mistake in describing the crash.  The problem is, as
  415. soon as I call one or two subroutines with a large number of local
  416. vars (~5K each) (i.e.  more than 8K of vars are on the stack -- the
  417. default stack size, according to IM II), I get either get "Stack
  418. Collision with Heap" or the window system goes crazy, as described
  419. before.
  420.  
  421. huge is not NIL -- I have convinced myself that it is being allocated
  422. correctly (the constant involved is (252^2) * 2 * 5 = 635040, a long).
  423. I get the impression that "SetApplLimit" is somehow not increasing the
  424. space for the stack.  I don't know why the space for the stack is not
  425. increasing.  It seems that the only way to increase space for the
  426. stack is to set the global variable "ApplLimit".
  427.  
  428. Don Gillies - gillies@cs.uiuc.edu - University of Illinois at Urbana-Champaign
  429.  
  430.  
  431. - -- 
  432.  
  433.  
  434.  
  435.  
  436. +++++++++++++++++++++++++++
  437.  
  438. From: REEKES@applelink.apple.com (Jim Reekes)
  439. Date: 2 Jun 92 01:34:42 GMT
  440. Organization: Apple Computer, Inc.
  441.  
  442. In article <1992Jun1.095859.5250@m.cs.uiuc.edu>, gillies@m.cs.uiuc.edu (Don Gillies) writes:
  443. > I am having a ridiculous problem with the memory manager.  I am using
  444. > THINK C 4.02, on a 5 Meg macintosh II with system 7.0.  My application
  445. > needs about 600K of the heap, and ~ 40K of stack.  I made the
  446. > partition 1150K and tried the following:
  447. >     SetZone(ApplicZone());
  448. >     printf("limit is %ld\n", GetApplLimit());    /* prints 2929K */
  449. >     printf("free is %ld\n", FreeMem());        /* prints 909K */
  450. >     newlimit = GetApplLimit() - 40000L;        /* is 2889K */
  451. >     SetApplLimit(newlimit);                /* crash here */
  452. >     printf("free is %ld\n", FreeMem());
  453. >     MaxApplZone();
  454. > The above code crashes in the "SetApplLimit" call.  The symptom of the
  455. > crash is that the screen erases and all the windows lose their
  456. > borders, and only the top-level window will appear on the screen
  457. > (without border).  All the other windows look like ghostly shadows,
  458. > and the finder seems to still be operating o.k., but because of the
  459. > ghostly windows, it is impossible to do useful work.
  460. > The code used to work if the newlimit was 10000L less than
  461. > GetApplLimit, but otherwise, it would not work.  Now I am using the
  462. > following code:
  463. >     SetZone(ApplicZone());
  464. >     printf("limit is %ld\n", GetApplLimit());
  465. >     printf("free is %ld\n", FreeMem());        /* 909K */
  466. >     newlimit = GetApplLimit() - 40000L;
  467. > /*    SetApplLimit(newlimit); */
  468. >     ApplLimit = newlimit;
  469. >     printf("free is %ld\n", FreeMem());        /* 909K - 10 */
  470. >     MaxApplZone();
  471. > This seems to work, but the amount of "FreeMem()" does not decrease
  472. > after I decrement the global variable "ApplLimit".  (it decreases by a
  473. > very small amount, presumably because of the "printf" command).  This
  474. > worries me.  Does anyone know what is the problem?  It seems like
  475. > "SetApplLimit" is flakey in this version of THINK C.  It seems like
  476. > assigning to the "ApplLimit" global variable does not adequately
  477. > inform the memory manager of the change in the application heap size.
  478.  
  479.  
  480. It works for me.  I can use this code, without the printf, just fine.
  481.  
  482. The interfaces for the routines you need are as follows:
  483.  
  484. #define GetApplLimit() (* (Ptr*) 0x0130)
  485.  
  486. pascal void SetApplLimit(void *zoneLimit)
  487.     = 0xA02D; 
  488.  
  489. These are simple enough and shouldn't be causing you any problems.
  490.  
  491. You certainly need to use SetApplLimit since it does more that just
  492. adjust the low memory global ApplLimit.  If SetApplLimit is crashing,
  493. you could have a trashed heap (try HC in MacsBug before calling
  494. the SetApplLimit).  The location you're pointing to may be too low
  495. that it points into your heap.  FreeMem may not change just because
  496. you're changing the lower limit of the stack, since the heap may have
  497. not been expanded yet.  To find out a better approximation of possible
  498. free bytes you'll have to call MaxApplZone but that has to happen after
  499. you adjust the stack. 
  500.  
  501. > It seems like
  502. > assigning to the "ApplLimit" global variable does not adequately
  503. > inform the memory manager of the change in the application heap size.
  504.  
  505. Yup, that's what I'm saying.
  506.  
  507. - -----------------------------------------------------------------------
  508. Jim Reekes, Polterzeitgeist  |     Macintosh Toolbox Engineering
  509.                              |          Sound Manager Expert
  510. Apple Computer, Inc.         | "All opinions expressed are mine, and do
  511. 20525 Mariani Ave. MS: 81-KS |   not necessarily represent those of my
  512. Cupertino, CA 95014          |       employer, Apple Computer Inc."
  513.  
  514. +++++++++++++++++++++++++++
  515.  
  516. From: gillies@m.cs.uiuc.edu (Don Gillies)
  517. Organization: University of Illinois, Dept. of Comp. Sci., Urbana, IL
  518. Date: Tue, 2 Jun 1992 05:49:20 GMT
  519.  
  520. REEKES@applelink.apple.com (Jim Reekes) writes:
  521.  
  522. >It works for me.  I can use this code, without the printf, just fine.
  523. >The interfaces for the routines you need are as follows:
  524.  
  525. >#define GetApplLimit() (* (Ptr*) 0x0130)
  526.  
  527. >pascal void SetApplLimit(void *zoneLimit)
  528. >    = 0xA02D; 
  529.  
  530. >These are simple enough and shouldn't be causing you any problems.
  531. >-----------------------------------------------------------------------
  532. >Jim Reekes, Polterzeitgeist  |     Macintosh Toolbox Engineering
  533. >                             |          Sound Manager Expert
  534. >Apple Computer, Inc.         | "All opinions expressed are mine, and do
  535. >20525 Mariani Ave. MS: 81-KS |   not necessarily represent those of my
  536. >Cupertino, CA 95014          |       employer, Apple Computer Inc."
  537.  
  538.  
  539. Thanks, this helped me to solve the problem.  I assume it was a either
  540. from bringing up the THINK C console and using printf() (which seems
  541. to allocate memory) before readjusting the heap size, or it was
  542. because I shouldn't have relied on the THINK C definition of
  543. SetApplLimit ( THINK C was not complaining with "check prototypes"
  544. turned on -- I assumed the compiler was understood the SetApplLimit
  545. call ).  Thanks to everyone who sent me email responses!
  546.  
  547. Don Gillies - gillies@cs.uiuc.edu - University of Illinois at Urbana-Champaign
  548.  
  549.  
  550. - -- 
  551.  
  552.  
  553.  
  554.  
  555. +++++++++++++++++++++++++++
  556.  
  557. From: ely@norton.com (Dave Ely)
  558. Date: 2 Jun 92 03:32:34 GMT
  559. Organization: Symantec / Peter Norton
  560.  
  561. gillies@m.cs.uiuc.edu (Don Gillies) writes:
  562. > I am having a ridiculous problem with the memory manager.  I am using
  563. > THINK C 4.02, on a 5 Meg macintosh II with system 7.0.  My application
  564. > needs about 600K of the heap, and ~ 40K of stack.  I made the
  565. > partition 1150K and tried the following:
  566. >     SetZone(ApplicZone());
  567. >     printf("limit is %ld\n", GetApplLimit());    /* prints 2929K */
  568. >     printf("free is %ld\n", FreeMem());        /* prints 909K */
  569. >     newlimit = GetApplLimit() - 40000L;        /* is 2889K */
  570. >     SetApplLimit(newlimit);                /* crash here */
  571. >     printf("free is %ld\n", FreeMem());
  572. >     MaxApplZone();
  573.  
  574. Calling printf before doing the SetApplLimit is probably what's
  575. causing all of your problems. Think loads the ANSI segment,
  576. initializes several managers, sets up a new window and all of it's
  577. associated structures. SetApplLimit needs to be called as early as
  578. possible, certainly before initializing anything and almost certainly
  579. before loading other segments. You might want to try something like
  580. this...
  581.  
  582. void main( void )
  583. {
  584. #define        kStackToUse    0x0000A000    /* 40K */
  585. ulong        stack_bottom;
  586. ulong        heap_top;
  587.  
  588.     heap_top = (ulong)ApplLimit;
  589.     asm {
  590.         move.l    a7, stack_bottom
  591.         }
  592.  
  593.     /* move heap down, make stack larger */
  594.     heap_top = stack_bottom - kStackToUse;
  595.     SetApplLimit( (Ptr)heap_top );
  596.  
  597.     /* expand the zone to max size */
  598.     MaxApplZone();
  599.  
  600.     etc. ...
  601.  
  602. }
  603.  
  604. Before doing the SetApplLimit you should probably also preflight the
  605. current zone and make sure it's big enough for your purposes.
  606.  
  607. - -- 
  608.  ______________________________________________________________
  609.     Dave Ely                    | Internet:  ely@norton.com
  610.     Symantec/Peter Norton Group | AppleLink: Ely.D
  611.  
  612. ---------------------------
  613.  
  614. From: caw@cs.mu.OZ.AU (Chris Wright)
  615. Subject: Globals, A5, and all that stuff...
  616. Organization: Computer Science, University of Melbourne, Australia
  617. Date: Mon, 1 Jun 1992 12:12:37 GMT
  618.  
  619. I understand, (I hope :-)), why one can't define A5 relative globals in 
  620. stand alone code ('cos they'd clobber the applications globals), and I'm
  621. led to believe that at interrupt time (such as VBI tasks), you can't trust
  622. ANYONE, and A5 could point at your grandmother's walking stick, but I'm
  623. not clear on why - in say an XCMD - one can't refer to the QD globals.
  624. I would have thought that A5 was still pointing at the boundary b/n tha
  625. app parameters and globals, and we all know what's -4(A5).
  626.  
  627. Could some one please help me?
  628.  
  629. Thanks,
  630.  
  631. chris
  632.  
  633. +++++++++++++++++++++++++++
  634.  
  635. From: keith@taligent.com (Keith Rollin)
  636. Date: 1 Jun 92 18:28:00 GMT
  637. Organization: Taligent
  638.  
  639. In article <9215322.28192@mulga.cs.mu.OZ.AU>, caw@cs.mu.OZ.AU (Chris Wright)
  640. writes:
  641. > I understand, (I hope :-)), why one can't define A5 relative globals in 
  642. > stand alone code ('cos they'd clobber the applications globals), and I'm
  643. > led to believe that at interrupt time (such as VBI tasks), you can't trust
  644. > ANYONE, and A5 could point at your grandmother's walking stick, but I'm
  645. > not clear on why - in say an XCMD - one can't refer to the QD globals.
  646. > I would have thought that A5 was still pointing at the boundary b/n tha
  647. > app parameters and globals, and we all know what's -4(A5).
  648.  
  649. Who says you can't refer to QD globals? Any time you make a call to something
  650. like GetPort() or Random(), you are referencing those globals.
  651.  
  652. > and we all know that's -4(A5).
  653.  
  654. DO NOT assume this is true! This is dependent on the implementation of the
  655. linker (see technote #208). (A5) points to the "thePort" field of the QD globals
  656. record. Work from that.
  657.  
  658. BTW: Check out Technote #256 for issues on using A5 in standalone code. There
  659. will also be an article in the next "develop" magazine (or the one after) that
  660. offers a new way of using A5 in standalone code under MPW.
  661.  
  662. - --
  663. Keith Rollin
  664. Phantom Programmer
  665. Taligent, Inc.
  666.  
  667. +++++++++++++++++++++++++++
  668.  
  669. From: keith@taligent.com (Keith Rollin)
  670. Date: 1 Jun 92 18:33:32 GMT
  671. Organization: Taligent
  672.  
  673. In article <67980@apple.Apple.COM>, keith@taligent.com (Keith Rollin) writes:
  674. > DO NOT assume this is true! This is dependent on the implementation of the
  675. > linker (see technote #208). (A5) points to the "thePort" field of the QD
  676. globals
  677. > record. Work from that.
  678.  
  679. Of course, when I say technote #208, I really mean #223.
  680.  
  681. - --
  682. Keith Rollin
  683. Phantom Programmer
  684. Taligent, Inc.
  685.  
  686. +++++++++++++++++++++++++++
  687.  
  688. From: daven@notable.com (Dave Newman)
  689. Date: 3 Jun 92 00:16:53 GMT
  690. Organization: Notable Technologies, Inc.
  691.  
  692.  
  693. In article <9215322.28192@mulga.cs.mu.OZ.AU> (comp.sys.mac.programmer), caw@cs.mu.OZ.AU (Chris Wright) writes:
  694. | I understand, (I hope :-)), why one can't define A5 relative globals in 
  695. | stand alone code ('cos they'd clobber the applications globals), and I'm
  696. | led to believe that at interrupt time (such as VBI tasks), you can't trust
  697. | ANYONE, and A5 could point at your grandmother's walking stick, but I'm
  698. | not clear on why - in say an XCMD - one can't refer to the QD globals.
  699. | I would have thought that A5 was still pointing at the boundary b/n tha
  700. | app parameters and globals, and we all know what's -4(A5).
  701. | Could some one please help me?
  702.  
  703. You may want to find a copy of the paper that Allan Foster and I wrote
  704. for last year's MacHack on this subject. Along with this paper we
  705. released to the public domain a runtime library to aid things like
  706. XCMD's in their use of A5, mutli-segmenting, C++ support, etc. This
  707. also included a MPW tool that performed a post-link operation on an
  708. application to turn it into standalone code. (i.e. you compile and
  709. link your XCMD as if it were an application and the post-link tool
  710. turns it into an single or mutli-segmented standalone code resource.)
  711.  
  712. - --Dave
  713.  
  714. PS - The paper, runtime library, post-link tool and their sources
  715. should be on both CIS and AOL. Since I have no ftp capabilities, I
  716. can't see if they made it into places like Sumex.
  717.  
  718. - -----------------------------------------------------------
  719. Dave Newman                 |  AOL:      AFC Tinman
  720. Artillery Spotter           |  CIS:      70743,3323
  721. Notable Technologies, Inc.  |  internet: daven@notable.com
  722. 510.208.4449                |  FAX:      510.444.4493
  723. - -----------------------------------------------------------
  724.  
  725. ---------------------------
  726.  
  727. From: zobkiw@world.std.com (Joe Zobkiw)
  728. Subject: Dumb THINK C Projects!
  729. Organization: The World Public Access UNIX, Brookline, MA
  730. Date: Mon, 1 Jun 1992 12:51:03 GMT
  731.  
  732. I download a THINK C project with all source. I go to compile it and
  733. it can't find the first file! I put the source files in the same
  734. folder as the project file. Still, no go. I resort to removing all
  735. project files and re-adding them. A royal pain.
  736.  
  737. Does anyone have a solution (ie: a hack) to fix this shortcoming
  738. in THINK C?
  739.  
  740.  
  741.  
  742.  
  743.  
  744.  
  745. - -- 
  746. - -- joe zobkiw                      Internet: zobkiw@world.std.com
  747. - --                                      AOL: AFL Zobkiw  
  748. - -- mac.synthesis.MIDI.THINK C.OOP.asm   CI$: 70712,515 
  749. - -- communications.networks.cool tunes...
  750.  
  751. +++++++++++++++++++++++++++
  752.  
  753. From: olson@groucho.wi.edu (Eric K. Olson)
  754. Organization: Whitehead Institute for Biomedical Research
  755. Date: Mon, 1 Jun 1992 17:10:16 GMT
  756.  
  757. In article <Bp63p4.EMs@world.std.com> zobkiw@world.std.com (Joe Zobkiw) writes:
  758. >I download a THINK C project with all source. I go to compile it and
  759. >it can't find the first file! I put the source files in the same
  760. >folder as the project file. Still, no go. I resort to removing all
  761. >project files and re-adding them. A royal pain.
  762. >
  763. >Does anyone have a solution (ie: a hack) to fix this shortcoming
  764. >in THINK C?
  765. >
  766.  
  767. Open the "Make" dialog, uncheck the "Quick Scan" checkbox, and
  768. click on "Use Disk."
  769.  
  770. Cheers!
  771.  
  772. - -Eric
  773.  
  774.  
  775.  
  776.  
  777. ---------------------------
  778.  
  779. From: zobkiw@world.std.com (Joe Zobkiw)
  780. Subject: Apple Modem Tool 1.1 Bugs?
  781. Organization: The World Public Access UNIX, Brookline, MA
  782. Date: Mon, 1 Jun 1992 12:55:25 GMT
  783.  
  784. Needless to say I'm implementing an application in THINK C 5.02 that
  785. uses the Connection Manager. Every tool I've used seems to work fine
  786. except for the Apple Modem Tool 1.1. Whenever I select this tool and
  787. click OK or Cancel in its configuration dialog, I crash! It seems I
  788. bomb in a ctmb (or is it cmtb? no code in front of me) and the THINK C
  789. Debugger points me right in my main event loop after my MouseDown handler.
  790.  
  791. I'm at a loss. This is on a IIcx with a Radius Rocket and 8 megs RAM.
  792. 7.0.1 in 32 bit mode with the latest Tuner. Any ideas? Is the AMT still
  793. as buggy as it was before they fixed it?
  794.  
  795.  
  796.  
  797.  
  798.  
  799. - -- 
  800. - -- joe zobkiw                      Internet: zobkiw@world.std.com
  801. - --                                      AOL: AFL Zobkiw  
  802. - -- mac.synthesis.MIDI.THINK C.OOP.asm   CI$: 70712,515 
  803. - -- communications.networks.cool tunes...
  804.  
  805. +++++++++++++++++++++++++++
  806.  
  807. From: paul@cthq.UUCP (Paul G. Smith)
  808. Date: 1 Jun 92 19:46:23 GMT
  809. Organization: CommsTalk HQ
  810.  
  811.  
  812. In article <Bp63wE.EsL@world.std.com> (comp.sys.mac.programmer), zobkiw@world.std.com (Joe Zobkiw) writes:
  813. > I'm at a loss. This is on a IIcx with a Radius Rocket and 8 megs RAM.
  814. > 7.0.1 in 32 bit mode with the latest Tuner. Any ideas? Is the AMT still
  815. > as buggy as it was before they fixed it?
  816.  
  817. Try AMT version 1.1.1, which is now up on AppleLink. I don't know if
  818. it's on ftp.apple.com; I don't have ftp access so I can't check.
  819.  
  820. best regards, Paul
  821.  
  822. - -------------------------------------
  823. Paul G Smith / CommsTalk HQ
  824. INTERNET:  "paul@cthq.uucp"            CIX:  "pgsmith"
  825. AppleLink: "commstalk.hq" ("commstalk.hq@applelink.apple.com")
  826. tel/fax:   + 44 491 574295  (dial 11 on 2nd dial tone for fax)
  827. snail:    40 St Marks Road, Henley-on-Thames, Oxon. RG9 1LW. UK
  828.  
  829. ---------------------------
  830.  
  831. From: bmor@kimbark.uchicago.edu (Brad Morris)
  832. Subject: Moving windowws
  833. Organization: University of Chicago Computing Organizations
  834. Date: Mon, 1 Jun 1992 13:43:53 GMT
  835.  
  836. I would like my app to have windows appear where they were when the program
  837. was last used.  I was not going to change the WIND resource because it is
  838. useful to have this as the default just in case the program is moved to
  839. a machine with a smaller screen.  What is the method for this?  I have
  840. tried using the window's regions bounding box to store an upper left and
  841. moving the window using the move command but the window keeps jumping to
  842. weird spots (title bar under the menu bar).  Thanks.
  843.  
  844. Brad Morris
  845. b-morris@uchicago.edu
  846.  
  847. +++++++++++++++++++++++++++
  848.  
  849. From: bmor@kimbark.uchicago.edu (Brad Morris)
  850. Organization: University of Chicago Computing Organizations
  851. Date: Tue, 2 Jun 1992 13:18:42 GMT
  852.  
  853. I have solved the problem.  I am now creating a 0,0 point, setting the port
  854. to the window I want to save, and converting the point from local to global.
  855. When my app is run, it tries to move the window if the point lies in the
  856. screen rect.  Thanks for those that replied.
  857.  
  858. ---------------------------
  859.  
  860. From: umnoor@ccu.umanitoba.ca (Nasir Ahmed Noor)
  861. Subject: Unet.Mac.Pgm.Guide in PostScript available for FTP
  862. Organization: University of Manitoba, Winnipeg, Canada
  863. Date: Tue, 2 Jun 1992 15:16:37 GMT
  864.  
  865.  
  866.  
  867. Hi,
  868. The Usenet Macintosh Programming Guide (in PostScript format) is now
  869. available for FTP at
  870.       ccu.umanitoba.ca
  871.       /pub/mac 
  872.          (usual ftp way to logg in).
  873.  
  874. The file is over 850k in size. Its uuencoded and compressed with zip. I can
  875. also make it available in unix compress (.Z) if quite a few people dont
  876. have access to "unzip" (contact me). The complete Guide is over 325 pages
  877. long (this is for those who have 200 page limit on their accounts).
  878.  
  879. You can contact me if you have any questions regarding this.
  880.  
  881. Regards,
  882. Nasir Ahmed Noor
  883. umnoor@ccu.umanitoba.ca
  884.  
  885. p.s. If your site does not have FTP facility available and you want me to
  886.      'mail' a copy to you, please make sure your account can handle a mail
  887.       larger than 200k.
  888. p.p.s This guide in PostScript format is not of any use if you dont have 
  889.       access to PostScript printer.
  890.  
  891. +++++++++++++++++++++++++++
  892.  
  893. From: umnoor@ccu.umanitoba.ca (Nasir Ahmed Noor)
  894. Organization: University of Manitoba, Winnipeg, Canada
  895. Date: Wed, 3 Jun 1992 00:03:38 GMT
  896.  
  897.  
  898.  
  899. I have made available a copy in .Z format in the same directory for
  900. ftp. Please report any problems.
  901.  
  902. Nasir Ahmed Noor
  903. umnoor@ccu.umanitoba.ca
  904.  
  905. ---------------------------
  906.  
  907. From: jverdega@cae.wisc.edu (Jeffrey Verdegan)
  908. Subject: Launching from a code resource, revisited...
  909. Date: 2 Jun 92 16:11:31 GMT
  910. Organization: U of Wisconsin-Madison College of Engineering
  911.  
  912. Our story so far:
  913. A while back, I posted asking how to launch an app from an INIT.  Thanks to 
  914. the vigilance and helpfulness of several netters, I was informed that my 
  915. terminology was in error, and what I really wanted to do was to launch from
  916. the code resource that is the trap patch that the INIT installs, and I was 
  917. pointed toward IM-VI, ch. 29 and TN 126.
  918.  
  919. Okay, so I've got this patch to _Control that watches for a NetWare volume
  920. to be mounted, does some stuff, and is then supposed to launch an app.  I've
  921. read through the IM-VI and TN 126 stuff on launching.  It mostly makes sense
  922. to me.  I think I can handle it, except for one thing...
  923.  
  924.  
  925. The Rub:
  926. At the end of the patch is the usual:
  927. asm
  928. {
  929.     move.l pb,a0        /* restore original passed pb */
  930.     movem.l (sp)+,a2-a3/d0-d7    /* restore our saved registers */
  931.     unlk a6            /* undo what the compiler does for you */
  932.     jmp (a1)        /* jump to old routine */
  933. }
  934.  
  935. Now, I either have to launch the app before this, and then when the app is
  936. done, return to jump to the original _Control trap, i.e. a sublaunch, or
  937. I have to jsr to the original routine, and then after I return from that,
  938. launch the app, i.e., a tail patch (actually, a combination head/tail patch,
  939. if I leave the rest of the patch where it is). 
  940.  
  941. >From what I understand, both of these are frowned upon.  My question is,
  942. which is the lesser of two evils, or, is there a better way that I'm completely
  943. missing? 
  944.  
  945. My thinking is that the tail patch would be preferable to the sublaunch, if
  946. for no other reason than that sublaunches seem to be even more strongly 
  947. discouraged in the literature than tail patches.  If I do go with the tail
  948. patch, is it okay to leave the head patch in place?
  949.  
  950. Any advice on this is *greatly* appreciated.
  951.  
  952.  
  953. Thanks,
  954. Jeff
  955.  
  956.  
  957. - ----------
  958.  
  959. Jeff Verdegan
  960. University of Wisconsin-Madison
  961. Computer-Aided Engineering Center
  962. jjv@caestaff.engr.wisc.edu
  963. (608) 263-1875
  964.  
  965. +++++++++++++++++++++++++++
  966.  
  967. From: resnick@cogsci.uiuc.edu (Pete Resnick)
  968. Organization: University of Illinois at Urbana
  969. Date: Wed, 3 Jun 1992 02:48:33 GMT
  970.  
  971. jverdega@cae.wisc.edu (Jeffrey Verdegan) writes:
  972.  
  973. >The Rub:
  974. >At the end of the patch is the usual:
  975. >asm
  976. >{
  977. >    move.l pb,a0        /* restore original passed pb */
  978. >    movem.l (sp)+,a2-a3/d0-d7    /* restore our saved registers */
  979. >    unlk a6            /* undo what the compiler does for you */
  980. >    jmp (a1)        /* jump to old routine */
  981. >}
  982.  
  983. First, I would save A1 as well since this is an OS Trap, put the
  984. address of the old routine on the stack, and RTS. That way you don't
  985. use any registers. But as for the rest......
  986.  
  987. >Now, I either have to launch the app before this, and then when the app is
  988. >done, return to jump to the original _Control trap, i.e. a sublaunch, or
  989. >I have to jsr to the original routine, and then after I return from that,
  990. >launch the app, i.e., a tail patch (actually, a combination head/tail patch,
  991. >if I leave the rest of the patch where it is). 
  992.  
  993. Better idea: Post a Notification with the nmStr, nmIcon, nmSound, and
  994. nmMark all set to 0 and the nmResp set to a routine that will launch
  995. the application. Very safe, guaranteed to be executed at non-interrupt
  996. or other nasty times, and you don't have to worry about saving
  997. registers, etc. And no slowing down the real operation of the _Control
  998. or need to do any tail patching. Very neat.
  999.  
  1000. pr
  1001. - --
  1002. Pete Resnick             (...so what is a mojo, and why would one be rising?)
  1003. Graduate assistant - Philosophy Department, Gregory Hall, UIUC
  1004. System manager - Cognitive Science Group, Beckman Institute, UIUC
  1005. Internet: resnick@cogsci.uiuc.edu
  1006.  
  1007. ---------------------------
  1008.  
  1009. From: sdm7g@aemsun.med.Virginia.EDU (Steven D. Majewski)
  1010. Subject: _Datainit() : what does it do & where does it do it?
  1011. Organization: University of Virginia - Physiology Dept.
  1012. Date: Tue, 2 Jun 1992 17:13:48 GMT
  1013.  
  1014. HELP
  1015.  
  1016. I keep getting an error from MPW Link :  
  1017. "Global data used ...   _Datainit() not called..."  
  1018. ( not exactly but close enough, I hope. )
  1019.  
  1020. Other than a single non-helpful reference in the MPW release notes, 
  1021. I can't find anything about this routine in the indexes ( MPW or MPW-C ).
  1022. I've also looked up all the entries for 'extern' in MPW C, but still no
  1023. clues. 
  1024.  
  1025. What does _Datainit() do?
  1026. When & how should it be called? 
  1027.  
  1028. I *guess* since I can't find instructions for that routine in the
  1029. manual, that it is NOT meant to be a user level call - i.e. there
  1030. is probably some OTHER routine that is supposed to call _Datainit(),
  1031. and THAT routine is not being called ( perhaps missing some linker
  1032. directive ? ) 
  1033.  
  1034. Any help or clues will be appreciated!
  1035. Thanks, 
  1036.  Steve Majewski
  1037.  
  1038.  
  1039. ======== "If you have a hammer, find a nail" - George Bush,'91  =========
  1040.  Steven D. Majewski        University of Virginia Physiology Dept.
  1041.  sdm7g@Virginia.EDU        Box 449 Health Sciences Center
  1042.  Voice: (804)-982-0831/32    1300 Jefferson Park Avenue
  1043.  FAX:   (804)-982-1616        Charlottesville, VA 22908
  1044.  
  1045. +++++++++++++++++++++++++++
  1046.  
  1047. From: keith@taligent.com (Keith Rollin)
  1048. Date: 2 Jun 92 19:30:14 GMT
  1049. Organization: Taligent
  1050.  
  1051. In article <1992Jun2.171348.26271@murdoch.acc.Virginia.EDU>,
  1052. sdm7g@aemsun.med.Virginia.EDU (Steven D. Majewski) writes:
  1053. > HELP
  1054. > I keep getting an error from MPW Link :  
  1055. > "Global data used ...   _Datainit() not called..."  
  1056. > ( not exactly but close enough, I hope. )
  1057. > Other than a single non-helpful reference in the MPW release notes, 
  1058. > I can't find anything about this routine in the indexes ( MPW or MPW-C ).
  1059. > I've also looked up all the entries for 'extern' in MPW C, but still no
  1060. > clues. 
  1061. > What does _Datainit() do?
  1062. > When & how should it be called? 
  1063. > I *guess* since I can't find instructions for that routine in the
  1064. > manual, that it is NOT meant to be a user level call - i.e. there
  1065. > is probably some OTHER routine that is supposed to call _Datainit(),
  1066. > and THAT routine is not being called ( perhaps missing some linker
  1067. > directive ? ) 
  1068.  
  1069. _DataInit is used to initialize your global variables. The exact steps it takes
  1070. are documented in Technote #240. However, it is likely that Technote #256 will
  1071. be more helpful to you. People usually get that error message when they are
  1072. creating standalone code that attempts to access global variables. Technote #256
  1073. addresses this problem explicitly.
  1074.  
  1075. - --
  1076. Keith Rollin
  1077. Phantom Programmer
  1078. Taligent, Inc.
  1079.  
  1080.  
  1081. +++++++++++++++++++++++++++
  1082.  
  1083. From: REEKES@applelink.apple.com (Jim Reekes)
  1084. Date: 2 Jun 92 20:01:40 GMT
  1085. Organization: Apple Computer, Inc.
  1086.  
  1087. In article <1992Jun2.171348.26271@murdoch.acc.Virginia.EDU>, sdm7g@aemsun.med.Virginia.EDU (Steven D. Majewski) writes:
  1088. > HELP
  1089. > I keep getting an error from MPW Link :  
  1090. > "Global data used ...   _Datainit() not called..."  
  1091. > ( not exactly but close enough, I hope. )
  1092. > Other than a single non-helpful reference in the MPW release notes, 
  1093. > I can't find anything about this routine in the indexes ( MPW or MPW-C ).
  1094. > I've also looked up all the entries for 'extern' in MPW C, but still no
  1095. > clues. 
  1096. > What does _Datainit() do?
  1097. > When & how should it be called? 
  1098. > I *guess* since I can't find instructions for that routine in the
  1099. > manual, that it is NOT meant to be a user level call - i.e. there
  1100. > is probably some OTHER routine that is supposed to call _Datainit(),
  1101. > and THAT routine is not being called ( perhaps missing some linker
  1102. > directive ? ) 
  1103.  
  1104. You have probably used a string constant in your code.  This means
  1105. that the compilier will collect this data into a segment that is meant
  1106. for use as an A5 offset.  All of your strings are allocated into the
  1107. global data space.  The compiler will automatically call the routine
  1108. DataInit to allocate and initialize this data.  You have to LINK with
  1109. Runtime.o to get this routine.
  1110.  
  1111. If you're writing stand alone code that does not have a global A5
  1112. data space, then you can have your strings compiled directly into your
  1113. code space by using the -b option for the C compilier.
  1114.  
  1115. If you look at the sample code that comes with MPW you'll find that it
  1116. will unload the DataInit code segment.  Since this code is automatically
  1117. supplied into it's own segment, you need to unload it too.
  1118.  
  1119. - -----------------------------------------------------------------------
  1120. Jim Reekes, Polterzeitgeist  |     Macintosh Toolbox Engineering
  1121.                              |          Sound Manager Expert
  1122. Apple Computer, Inc.         | "All opinions expressed are mine, and do
  1123. 20525 Mariani Ave. MS: 81-KS |   not necessarily represent those of my
  1124. Cupertino, CA 95014          |       employer, Apple Computer Inc."
  1125.  
  1126. ---------------------------
  1127.  
  1128. End of C.S.M.P. Digest
  1129. **********************
  1130.